package cn.itsource.ymcc.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 课程目录
 * </p>
 *
 * @author whale.chen
 * @since 2023-02-27
 */
@TableName("t_course_type")
@Data
@Accessors(chain=true)
public class CourseType extends Model<CourseType> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Date createTime;

    private Date updateTime;

    /**
     * 类型名
     */
    @NotBlank(message = "名字不能为空")
    private String name;

    /**
     * 父ID
     */
    @NotNull(message = "父id不能为空")
    private Long pid;

    /**
     * 图标
     */
    private String logo;

    /**
     * 描述
     */
    private String description;

    private Integer sortIndex;

    /**
     * 路径
     */
    private String path;

    /**
     * 课程数量
     */
    private Integer totalCount;

    @TableField(exist = false)
    private List<CourseType> children = new ArrayList<>();
}
